//
//  CTMediator+WSAlterAction.m
//  CharonTVProject
//
//  Created by karong on 2023/6/21.
//

#import "CTMediator+WSAlterAction.h"
/// 類名
NSString * const WSCTMediatorTargetAlter = @"Alter";
/// 方法名
NSString * const WSCTMediatorActioncharonTV_ShowAlter = @"charonTV_showAlter";
NSString * const WSCTMediatorActioncharonTV_ShowTipsAlter = @"charonTV_showTipsAlter";
NSString * const WSCTMediatorActioncharonTV_ShowTextFieldAlter = @"charonTV_showTextFieldAlter";
NSString * const WSCTMediatorActioncharonTV_ShowTextViewAlter = @"charonTV_showTextViewAlter";
NSString * const WSCTMediatorActioncharonTV_ShowPickerAlter = @"charonTV_showPickerAlter";

@implementation CTMediator (WSAlterAction)

- (UIViewController *)ct_showcharonTV_AlterWithTitle:(NSString *)title content:(NSString *)content confirm:(NSString *)confirm confirmHandle:(charonTV_EmptyBlock)confirmHandle cancel:(NSString *)cancel {
    NSMutableDictionary * params = [NSMutableDictionary new];
    if (!WSIsNullOrEmpty(title))params[@"titleStr"] = title;
    if (!WSIsNullOrEmpty(content))params[@"content"] = content;
    if (!WSIsNullOrEmpty(confirm))params[@"confirm"] = confirm;
    if (!WSIsNullOrEmpty(cancel))params[@"cancel"] = cancel;
    if (confirmHandle)params[@"confirmHandle"] = confirmHandle;
    return [self performTarget:WSCTMediatorTargetAlter
                        action:WSCTMediatorActioncharonTV_ShowAlter
                        params:params
             shouldCacheTarget:YES];
}

- (UIViewController *)ct_showcharonTV_TFAlterWithTitle:(NSString *)title content:(NSString *)content placeholderStr:(NSString *)placeholderStr maxWordCount:(NSInteger)maxWordCount confirm:(NSString *)confirm confirmHandle:(charonTV_StringBlock)confirmHandle cancel:(NSString *)cancel {
    NSMutableDictionary * params = [NSMutableDictionary new];
    if (!WSIsNullOrEmpty(title))params[@"titleStr"] = title;
    if (!WSIsNullOrEmpty(content))params[@"content"] = content;
    if (!WSIsNullOrEmpty(confirm))params[@"confirm"] = confirm;
    if (!WSIsNullOrEmpty(cancel))params[@"cancel"] = cancel;
    if (confirmHandle)params[@"confirmHandle"] = confirmHandle;
    params[@"maxWordCount"] = @(maxWordCount);
    params[@"placeholderStr"] = WSEmptyStr(placeholderStr);
    return [self performTarget:WSCTMediatorTargetAlter
                        action:WSCTMediatorActioncharonTV_ShowTextFieldAlter
                        params:params
             shouldCacheTarget:YES];
}

- (UIViewController *)ct_showcharonTV_TVAlterWithTitle:(NSString *)title content:(NSString *)content maxWordCount:(NSInteger)maxWordCount confirm:(NSString *)confirm confirmHandle:(charonTV_StringBlock)confirmHandle cancel:(NSString *)cancel {
    NSMutableDictionary * params = [NSMutableDictionary new];
    if (!WSIsNullOrEmpty(title))params[@"titleStr"] = title;
    if (!WSIsNullOrEmpty(content))params[@"content"] = content;
    if (!WSIsNullOrEmpty(confirm))params[@"confirm"] = confirm;
    if (!WSIsNullOrEmpty(cancel))params[@"cancel"] = cancel;
    if (confirmHandle)params[@"confirmHandle"] = confirmHandle;
    params[@"maxWordCount"] = @(maxWordCount);
    return [self performTarget:WSCTMediatorTargetAlter
                        action:WSCTMediatorActioncharonTV_ShowTextViewAlter
                        params:params
             shouldCacheTarget:YES];
}

- (UIViewController *)ct_showcharonTV_PickerAlterWithTitle:(NSString *)title dataArray:(NSArray *)dataArray selectHandle:(charonTV_AnyObjectBlock)selectHandle {
    NSMutableDictionary * params = [NSMutableDictionary new];
    if (!WSIsNullOrEmpty(title))params[@"title"] = title;
    if (selectHandle)params[@"selectHandle"] = selectHandle;
    params[@"dataArray"] = dataArray;
    return [self performTarget:WSCTMediatorTargetAlter
                        action:WSCTMediatorActioncharonTV_ShowPickerAlter
                        params:params
             shouldCacheTarget:YES];
}

- (UIViewController *)ct_showcharonTV_RoleAlter {
    return [self ct_showcharonTV_TipsAlterWithTitle:@"活動規則" content:@"1、每日簽到可獲得對應的獎勵，連續簽到7天可獲得福利大獎。\n2、簽到次數當週累計，每週日24:00清零。\n3、簽到獎勵在簽到成功後1-2小時內到賬；\n4、通過不正當手段參與活動的耽迷們，將會取消你的獲獎資格。\n注:簽到玩法獎池會不定期更新，請隨時關注" confirm:nil];
}

- (UIViewController *)ct_showcharonTV_TipsAlterWithTitle:(NSString *)title content:(NSString *)content confirm:(NSString *)confirm {
    NSMutableDictionary * params = [NSMutableDictionary new];
    if (!WSIsNullOrEmpty(title))params[@"titleStr"] = APPLocalized(title);
    if (!WSIsNullOrEmpty(content))params[@"content"] = APPLocalized(content);
    if (!WSIsNullOrEmpty(confirm))params[@"confirm"] = APPLocalized(confirm);
    return [self performTarget:WSCTMediatorTargetAlter
                        action:WSCTMediatorActioncharonTV_ShowTipsAlter
                        params:params
             shouldCacheTarget:YES];
}
@end
